/**
 * 
 */
package com.youth.fund.hk.hostManager.common.service.impl;

import java.util.List;

import com.youth.fund.hk.hostManager.common.dao.ICommonDao;
import com.youth.fund.hk.hostManager.common.service.ICommonService;

/**
 * @author Sunk_Sky
 *
 * 2014年11月9日下午1:00:18
 */
public abstract class CommonService<M extends java.io.Serializable> implements ICommonService<M>
{
	protected ICommonDao<M> commonDao;
	
	public abstract void setCommonDao(ICommonDao<M> commonDao);
	
	public abstract void generateHtml(M model);

	/* (non-Javadoc)
	 * @see com.youth.fund.hk.hostManager.common.service.ICommonService#create(java.io.Serializable)
	 */
	@Override
	public boolean create(M model)
	{
		boolean result = commonDao.create(model);
		
		this.generateHtml(model);
		
		return result;
	}

	/* (non-Javadoc)
	 * @see com.youth.fund.hk.hostManager.common.service.ICommonService#delete(java.io.Serializable)
	 */
	@Override
	public boolean delete(M model)
	{
		boolean result = commonDao.delete(model);
		
		this.generateHtml(model);
		
		return result;
	}

	/* (non-Javadoc)
	 * @see com.youth.fund.hk.hostManager.common.service.ICommonService#update(java.io.Serializable)
	 */
	@Override
	public boolean update(M model)
	{
		boolean result = commonDao.update(model);
		
		this.generateHtml(model);
		
		return result;
	}

	/* (non-Javadoc)
	 * @see com.youth.fund.hk.hostManager.common.service.ICommonService#query(java.io.Serializable)
	 */
	@Override
	public List<M> query(M model)
	{
		return commonDao.query(model);
	}

	@Override
	public M queryOne(M model)
	{
		return commonDao.queryOne(model);
	}

}
